package com.example.wilson.lesson11;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class SearchManagerDemo extends AppCompatActivity implements View.OnClickListener {
    private EditText etdata;
    private Button btnsearch;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_search_manager_demo);
        etdata = (EditText)findViewById(R.id.etdata);
        btnsearch = (Button)findViewById(R.id.btncall);
        btnsearch.setOnClickListener(this);
    }

    @Override
    public void onClick(View view) {
        onSearchRequested();
    }

    public boolean onSearchRequested(){
        String text = etdata.getText().toString();
        Bundle bundle = new Bundle();
        bundle.putString("data", text);

        startSearch("wilson", false, bundle, false);

        return true;
    }

    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
}
